package zheezes.eisp.monitor.model;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;

import zheezes.eisp.data.orm.CollectTask;


import com.ibatis.sqlmap.client.SqlMapClient;

public class TaskListFactory {
	private SqlMapClient sqlMapper;
	
	private ResourceBundle resourceBundle;

	public List<TaskVo> create() {
		List res = null;
		try {
			res = sqlMapper.queryForList("queryAllCollectTasks");
		} catch (SQLException e) {
			e.printStackTrace();
		}
		List<TaskVo> list = new ArrayList<TaskVo>();
		if (res != null) {
			for (Object o : res) {
				TaskVo vo = new TaskVo();
				vo.setModel((CollectTask) o);
				vo.setResourceBundle(resourceBundle);
				list.add(vo);
			}
		}
		return list;
	}

	public void setSqlMapper(SqlMapClient sqlMapper) {
		this.sqlMapper = sqlMapper;
	}

	public void setResourceBundle(ResourceBundle resourceBundle) {
		this.resourceBundle = resourceBundle;
	}
}
